package com.shop2cn.iapi.agentproducts.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.shop2cn.iapi.agentproducts.parameter.AddAgentProductBean;
import com.shop2cn.iapi.agentproducts.parameter.DistributorListBean;
import com.shop2cn.iapi.agentproducts.service.DistributorListCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.AddAgentProductCallService;
/**
*分销员商品列表Test
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_DistributorList{
	private static DistributorListBean distributorlistBean;
	private static DistributorListCall distributorlistCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("分销员商品列表Test");
	}

	@Before
	public void caseUp() {
		distributorlistBean=new DistributorListBean();
		distributorlistCall=new DistributorListCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(distributorlistCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_DistributorList_001() {
		Logger.start(true,"正确数据，成功");
		try {
			
			int rootUserId=501150552;
			int distributorId=501150553;
			AddAgentProductBean addAgentProductBean = AddAgentProductCallService.initAddAgentProduct(rootUserId,
					"", false);
			String productId = AddAgentProductCallService.AddAgentProduct(addAgentProductBean);
			Thread.sleep(5000);
			
			distributorlistBean.setTitle(addAgentProductBean.getTitle());
			distributorlistBean.setUserId(501150552);;
			distributorlistBean.setPageIndex(1);
			distributorlistBean.setPageSize(50);
			distributorlistCall.setData(distributorlistBean);
			distributorlistCall.callService();			
			Logger.verifyEquals("200", distributorlistCall.getString("code"), "验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}